import { getUnreadAlarmList } from '@/api/alarm'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAlarmStore = defineStore('alarmStore', () => {
  const alarmCount = ref<number>(0)
  const alarmList = ref<[]>([])

  async function getAlarmCount () {
    const { data } = await getUnreadAlarmList({
      pageSIze: -1,
    })
    alarmCount.value = data.total
    alarmList.value = data.records
  }

  return { alarmCount, alarmList, getAlarmCount }
})
